/**
 * 
 */
var myApp = angular.module('myApp', []);

myApp.directive('uiDate', function() {
    return {
      require: '?ngModel',
      link: function($scope, element, attrs, controller) {
          element.mask("99/99/9999",{completed: function() {
        	  controller.$setViewValue(this.val());
              $scope.$apply();
          }});
      }
    };
  });

myApp.directive('uiCpf', function() {
    return {
      require: '?ngModel',
      link: function($scope, element, attrs, controller) {
          element.mask("999.999.999-99",{completed: function() {
        	  controller.$setViewValue(this.val());
              $scope.$apply();
          }});
      }
    };
  });


function Usuario($scope,$http){
	
	$scope.mostraForm = true;
	var usuario = {};
	
	$scope.eviarNovoUsuario = function(){
		usuario = {
				"nome":$scope.nome,
				"sexo":$scope.sexo,
				"dtNascimento":$scope.dtNascimento,
				"cpf" :$scope.cpf,
				"cep":$scope.cep,
				"estado":$scope.estado,
				"cidade":$scope.cidade,
				"celular":$scope.celular,
				"residencial":$scope.residencial,
				"telContato":$scope.telContato,
				"nomeContato":$scope.nomeContato,
				"email":$scope.email,
				"senha":$scope.senha
		};
		$http.post("http://localhost:8080/restservice/usuario/inserir",usuario);
//		$scope.mostraForm = false;
	};
	
}